<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
      xmlns:p="http://xmlns.jcp.org/jsf/passthrough">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputLabel value="#{messages.Learningresource}"/>
        </ui:define>
        <ui:define name="body">
            <h:form styleClass="jsfcrud_list_form" enctype="multipart/form-data" id="form">
                <h:panelGrid columns="1">
                    <h:panelGrid columns="2">
                        <c:forEach begin="1" end="#{learningresourceController.numberOfnewFilePart()}" var="index">
                            <h:outputLabel value="#{index}"  dir="RTL"/>
                            <h:inputFile value="#{learningresourceController.filesPart[index]}" validator="#{learningresourceController.fileValidate}"
                                         p:placeholder="#{messages.No}#{messages.More}#{messages.Than}#{learningresourceControllerA.maxSize}"/>
                        </c:forEach>

                        <h:commandButton id="upload" action="#{learningresourceController.createLearningResource()}" value="#{messages.Finished}"/>
                        <h:outputLabel/> 
                    </h:panelGrid> 
                    <fieldset id="image" title="#{messages.Image}">

                        <legend>#{messages.If} #{messages.Necessary},#{messages.Continue} #{messages.Add} #{messages.Other}</legend> 
                        <h:panelGrid columns="1">
                            <!-- 连接到在知识点中新建学习资源，包括图像、音频和视频等 -->
                            <c:forEach items="#{learningresourceControllerA.mediaMap}" var="resource">
                                <h:commandButton action="#{learningresourceController.prepareAndUpdateLearningResource(resource.key)}" 
                                                 value="#{messages.Add}#{resource.value}" rendered="#{learningresourceController.notImage(resource)}"/>
                            </c:forEach>
                        </h:panelGrid>
                    </fieldset> 

                </h:panelGrid>
            </h:form>
        </ui:define>
    </ui:composition>
</html>
